<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>         
<!DOCTYPE html>
<html>
<head>
    <title>课程表表头</title>
    <%@include file="/WEB-INF/jspf/meta/meta.jspf" %>
    <%@include file="/WEB-INF/jspf/adminPage.jspf" %>
    <%@include file="/WEB-INF/jspf/css_js/easyui_grid_tools_js.jspf"%>
    <script type="text/javascript" src="<%=request.getContextPath()%>/static/course/update.js"></script>
</head>
<body>
<table id="dg_courseUpdate" class="easyui-datagrid"
       data-options="
		fit:true
		,url:'<%=request.getContextPath()%>/course/list2.json'
		,queryParams:{id:${Course1Object.course1Id }}
		,fitColumns:false
		,singleSelect:true
		,toolbar:'#tb_course'
		,onClickCell:onClickCell
        ,onEndEdit: onEndEdit
		">
    <thead>
    <tr>
 	    <th data-options="field:'course2Week',width:80,align:'center'">星期几</th>
    	<th data-options="field:'course2Day',width:125,align:'center',editor:'datebox',required:true">日期</th>
    	<th data-options="field:'classroomId',hidden:true">教室主键 我是隐藏的。你看不见我</th>
        <th data-options="field:'classroomName',width:125,align:'center',
						editor:{
							type:'combobox',
							options:{
								valueField:'classroomId',
								textField:'classroomName',
								width:200,
								method:'post',
								url:'<%=request.getContextPath()%>/classroom/selectAllClassroomByName.json'
							}
						}">教室</th>
        <th data-options="field:'course2Morning',width:200,align:'center',editor:'text'">上午课</th>
        <th data-options="field:'course2Afternoon',width:200,align:'center',editor:'text'">下午课</th>
        <th data-options="field:'course2Night',width:70,align:'center',editor:'text'">晚自习</th>
        <th data-options="field:'teacherId',hidden:true">教师主键</th>
        <th data-options="field:'teacherName',width:135,align:'center',
						editor:{
							type:'combobox',
							options:{
								valueField:'teacherId',
								textField:'teacherName',
								width:200,
								method:'post',
								url:'<%=request.getContextPath()%>/grade/selectAllByTeacherName.json'
							}
						}">教师</th>
		
		<th data-options="field:'course2Time',width:35,align:'center',editor:'text'">课时</th>
		<th data-options="field:'course2Info',width:200,align:'center',editor:'text'">备注</th>
    </tr>
    </thead>
</table>
    <%--工具栏--%>
    <div id="tb_course" style="height:auto;padding: 5px;" >
        <div>
            <a href="javascript:void(0)" class="easyui-linkbutton" plain="true" onclick="addRow()">添加行</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" plain="true" onclick="dellRow()">移除行</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" plain="true" onclick="MoveUp()">上移</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" plain="true" onclick="MoveDown()">下移</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="submitForm()">保存</a>
        </div>
        <br>
        <div>
            <form id="form_courseUpdate" method="post">
                <input type="hidden" id="bodyJsonData" name="bodyJsonData" />
                <!-- 表头主键 不可少！-->
                <input type="hidden" id="course1Id" name="course1Id" value="${Course1Object.course1Id }"/>
                
                <table cellpadding="5">
                    <tr>
                        <td>开始时间:</td>
                        <td><input name="course1Start" value="<fmt:formatDate value="${Course1Object.course1Start }" pattern="yyyy-MM-dd"/>" class="easyui-datebox" data-options="sharedCalendar:'#cc'"></td>
                        <td> 结束时间:</td>
                        <td><input name="course1End"  value="<fmt:formatDate value="${Course1Object.course1End }" pattern="yyyy-MM-dd"/>"class="easyui-datebox" data-options="sharedCalendar:'#cc'"></td>
                        <td>
                         	<input type="hidden" name="gradeName" id="gradeName" value="${Course1Object.gradeName }"/>
                            <input id="gradeId" name="gradeId" value="${Course1Object.gradeId }" editable="false" class="easyui-combobox" 
                             data-options="label:' 选择班级:'" style="width: 218px"/>
                            <script type="text/javascript">
								$("#gradeId").combobox({
									url: '<%=request.getContextPath()%>/course/selectAllGradeName.json',
									method : "post",
									valueField:'gradeId',
									textField:'gradeName',
									onSelect: function(rec){
									  $("#gradeName").val(rec.gradeName);
								    }
								});
							</script>
                        </td>
                    </tr>
                    <tr>
                    	<td>备注:</td>
                        <td colspan="5"><input name="course1Info" value="${Course1Object.course1Info }" class="easyui-textbox" style="width: 99%"></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
	<div id="cc" class="easyui-calendar"></div>
 </body>
</html>
